/*
 *  This file is part of libgolf.
 * 
 *  libgolf is free software: you can redistribute it and/or modify
 *  it under the terms of the GNU General Public License as published by
 *  the Free Software Foundation, either version 3 of the License, or
 *  (at your option) any later version.
 * 
 *  libgolf is distributed in the hope that it will be useful,
 *  but WITHOUT ANY WARRANTY; without even the implied warranty of
 *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 *  GNU General Public License for more details.
 *
 *  You should have received a copy of the GNU General Public License
 *  along with libgolf.  If not, see <http://www.gnu.org/licenses/>.
 */

/*
 * CxxTest reference: http://cxxtest.sourceforge.net/guide.html
 */

#ifndef _TESTGOLFHOLE_H
#define _TESTGOLFHOLE_H

#include <cxxtest/TestSuite.h>
#include "../gensrc/Golfhole.h"

class testGolfhole : public CxxTest::TestSuite
{
    public:
        void test_golfhole_ctor(void)
        {
            Golfhole    gh(1u, 4u, 15u, 325u);
            
            TS_ASSERT_EQUALS(gh.get_number(), 1u);
            TS_ASSERT_EQUALS(gh.get_par(), 4u);
            TS_ASSERT_EQUALS(gh.get_SI(), 15u);
            TS_ASSERT_EQUALS(gh.get_length(), 325u);
        }
        
        void test_golfhole_cctor(void)
        {
            Golfhole    src(5u, 5u, 11u, 525u);
            Golfhole    dst(src);

            src.set_par(3u);
            TS_ASSERT_EQUALS(dst.get_number(), 5u);
            TS_ASSERT_EQUALS(dst.get_par(), 5u);
            TS_ASSERT_EQUALS(dst.get_SI(), 11u);
            TS_ASSERT_EQUALS(dst.get_length(), 525u);
        }
        
        void test_golfhole_operator_copy(void)
        {
            Golfhole    src(5u, 5u, 11u, 525u);
            Golfhole    dst = src;

            src.set_par(3u);
            TS_ASSERT_EQUALS(dst.get_number(), 5u);
            TS_ASSERT_EQUALS(dst.get_par(), 5u);
            TS_ASSERT_EQUALS(dst.get_SI(), 11u);
            TS_ASSERT_EQUALS(dst.get_length(), 525u);
        }
        
        void test_golfhole_get_set(void)
        {
            Golfhole    gh(1u, 4u, 15u, 325u);
            
            gh.set_number(17u);
            TS_ASSERT_EQUALS(gh.get_number(), 17u);
            gh.set_par(3u);
            TS_ASSERT_EQUALS(gh.get_par(), 3u);
            gh.set_SI(1u);
            TS_ASSERT_EQUALS(gh.get_SI(), 1u);
            gh.set_length(154u);
            TS_ASSERT_EQUALS(gh.get_length(), 154u);
        }
        
};

#endif /* _TESTGOLFHOLE_H */
